home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / UbuntuSystemService / utils.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  956 b   |  27 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import re
  5.  
  6. def verify_proxy(proxy_type, proxy):
  7.     '''
  8.     This verifies a proxy string. It works by whitelisting
  9.     certain charackters: 0-9a-zA-Z:/?=-;~+
  10.     '''
  11.     verify_str = '%s://[a-zA-Z0-9.-]+:[0-9]+/*$' % proxy_type
  12.     if not re.match(verify_str, proxy):
  13.         return False
  14.     return True
  15.  
  16.  
  17. def verify_no_proxy(proxy):
  18.     '''
  19.     This verifies a proxy string. It works by whitelisting
  20.     certain charackters: 0-9a-zA-Z:/?=-;~+
  21.     '''
  22.     verify_str = '[a-zA-Z0-9.-:,]+'
  23.     if not re.match(verify_str, proxy):
  24.         return False
  25.     return True
  26.  
  27.